package com.project.design.algorithm;

public class QuickSort {

    public void sort(Integer[] str, int left, int right) {
        int i ,j,temp,t;
        if (left > right){
            return;
        }
        i = left;
        j = right;
        temp = str[left];

        while (i < j){
            while (temp <= str[j] && i <j){
                j--;
            }
            while (temp >= str[i] && i < j){
                i++;
            }
            if (i < j){
                t = str[j];
                str[j] = str[i];
                str[i] = t;
            }
        }

        str[left] = str[i];
        str[i]= temp;

        sort(str,left,j-1);
        sort(str,j+1,right);

    }


}
